package com.bohua.Car.admin.controller;

import com.bohua.Car.admin.common.Lay;
import com.bohua.Car.admin.common.Msg;
import com.bohua.Car.admin.entity.CarRental;
import com.bohua.Car.admin.service.CarRentalService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/07
 */
@Controller
@RequestMapping("/carRental")
public class CarRentalController {
    @Resource
    private CarRentalService carRentalService;

    @RequestMapping
    public String carRental(){
        return "carRental/carRental.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "carRental/addCarRental.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "carRental/updateCarRental.html";
    }

    @RequestMapping("/getCarRentals")
    @ResponseBody
    public Lay getCarRentals(CarRental carRental, Integer page, Integer limit){
        return carRentalService.getCarRentals(carRental,page,limit);
    }
    @RequestMapping("/addCarRental")
    @ResponseBody
    public Msg addCarRental(CarRental carRental){
        return carRentalService.addCarRental(carRental);
    }

    @RequestMapping("/updateCarRental")
    @ResponseBody
    public Msg updateCarRental(CarRental carRental){
        return carRentalService.updateCarRental(carRental);
    }

    @RequestMapping("/delCarRental")
    @ResponseBody
    public Msg delCarRental(CarRental carRental){
        return carRentalService.delCarRental(carRental);
    }
}
